home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / SNNSV32.ZIP / SNNSv3.2 / xgui / sources / bn_art2.ph < prev    next >
Encoding:
Text File  |  1994-04-25  |  5.5 KB  |  196 lines

  1. /*****************************************************************************
  2.   FILE           : bn_art2.ph
  3.   SHORTNAME      : bn_art2
  4.   SNNS VERSION   : 3.2
  5.  
  6.   PURPOSE        : 
  7.   NOTES          :
  8.  
  9.   AUTHOR         : Kai-Uwe Herrmann
  10.   DATE           : 15.1.1993
  11.  
  12.   CHANGED BY     : 
  13.   IDENTIFICATION : @(#)bn_art2.ph    1.7 3/2/94
  14.   SCCS VERSION   : 1.7
  15.   LAST CHANGE    : 3/2/94
  16.  
  17.              Copyright (c) 1990-1994  SNNS Group, IPVR, Univ. Stuttgart, FRG
  18.  
  19. ******************************************************************************/
  20. #ifndef _BN_ART2_DEFINED_
  21. #define  _BN_ART2_DEFINED_
  22.  
  23. /* begin global definition section */
  24.  
  25. void bn_createART2 (void);
  26.  
  27. /* end global definition section */
  28.  
  29.  
  30. /* begin private definition section */
  31.  
  32. /* define noise function for contrast enhancement */
  33. /* Possible choices are:   "Out_ART2_Noise_PLin"
  34.                            "Out_ART2_Noise_ContDiff"
  35. */
  36. #define ART2_NOISE_FUNCTION  "Out_ART2_Noise_ContDiff"
  37.  
  38. /* Definition of the Activationfunctions */
  39.  
  40. /* F0-Layer */
  41. #define ACTF_INP "Act_Identity"
  42.  
  43. /* F1-Layer */
  44. #define ACTF_P   "Act_ART2_Identity"
  45. #define ACTF_Q   "Act_ART2_NormP"
  46. #define ACTF_U   "Act_ART2_NormV"
  47. #define ACTF_V   "Act_ART2_Identity"
  48. #define ACTF_W   "Act_ART2_Identity"
  49. #define ACTF_X   "Act_ART2_NormW"
  50. #define ACTF_R   "Act_ART2_NormIP"
  51.  
  52. /* F2-Layer */
  53. #define ACTF_REC "Act_ART2_Rec"
  54. #define ACTF_RST "Act_ART2_Rst"
  55.  
  56.  
  57.  
  58. /* Definition of the Output Function */
  59.  
  60. /* F0-Layer */
  61. #define OUTF_INP "Out_Identity"
  62.  
  63. /* F1-Layer */
  64. #define OUTF_P   "Out_Identity"
  65. #define OUTF_Q   ART2_NOISE_FUNCTION   /* This output function has to be
  66.                                           the same as for Units X
  67.                                           (Noise Reduction/Contrast enhancem.)
  68.                                        */
  69. #define OUTF_U   "Out_Identity"
  70. #define OUTF_V   "Out_Identity"
  71. #define OUTF_W   "Out_Identity"
  72. #define OUTF_X   ART2_NOISE_FUNCTION   /* This output function has to be
  73.                                           the same as for Units Q
  74.                                           (Noise Reduction/Contrast enhancem.)
  75.                                        */
  76. #define OUTF_R   "Out_Identity"
  77.  
  78. /* F2-Layer */
  79. #define OUTF_REC "Out_Identity"
  80. #define OUTF_RST "Out_Identity"
  81.  
  82.  
  83. /* Learning function name */
  84. #define LEARN_FUNC_NAME        "ART2"
  85.  
  86. /* Update function name */
  87. #define UPDATE_FUNC_NAME       "ART2_Stable"
  88.  
  89.  
  90.  
  91.  
  92. /* returns 0 if x<=0 and 1 if x>0
  93. */
  94. #define POS_SIGN(x)            (((x) > 0) ? 1 : 0)
  95.  
  96. /* Calculates the number of columns when no of units and no. of rows is given
  97. */
  98. #define NO_OF_COLS(units,rows)  ((int) (units/rows) + POS_SIGN(units % rows))
  99.  
  100. #define MAX(x,y)                ((x) > (y) ? (x) : (y))
  101.  
  102.  
  103. /* Calculating the unit numbers */
  104.  
  105. #define INP_UNIT(y)             y
  106.  
  107. #define W_UNIT(y)               INP_UNIT(f1Units) + y
  108. #define X_UNIT(y)               W_UNIT(f1Units) + y
  109. #define U_UNIT(y)               X_UNIT(f1Units) + y
  110. #define V_UNIT(y)               U_UNIT(f1Units) + y
  111. #define P_UNIT(y)               V_UNIT(f1Units) + y
  112. #define Q_UNIT(y)               P_UNIT(f1Units) + y
  113. #define R_UNIT(y)               Q_UNIT(f1Units) + y
  114.  
  115. #define REC_UNIT(y)             R_UNIT(f1Units) + y
  116. #define RST_UNIT(y)             REC_UNIT(f2Units) + y
  117.  
  118.  
  119.  
  120. /* calculating the unit positions */
  121.  
  122. #define F1_COLS                 NO_OF_COLS(f1Units, f1Rows)
  123. #define F2_COLS                 NO_OF_COLS(f2Units, f2Rows)
  124.  
  125. #define OFFSET_X                0
  126. #define OFFSET_Y                0
  127.  
  128. #define INP_X                   OFFSET_X + 1
  129. #define INP_Y                   OFFSET_Y + 4 + f1Rows
  130.  
  131. #define W_X                     INP_X + F1_COLS + 1
  132. #define W_Y                     OFFSET_Y + 4
  133. #define X_X                     W_X
  134. #define X_Y                     W_Y + 1
  135. #define U_X                     W_X + 1
  136. #define U_Y                     W_Y
  137. #define V_X                     U_X
  138. #define V_Y                     X_Y
  139. #define P_X                     U_X + 1
  140. #define P_Y                     W_Y
  141. #define Q_X                     P_X
  142. #define Q_Y                     V_Y
  143. #define R_X                     P_X
  144. #define R_Y                     P_Y - 1
  145.  
  146. #define REC_X                   W_X + 4*F1_COLS + 1
  147. #define REC_Y                   OFFSET_Y + 3
  148. #define RST_X                   REC_X + F2_COLS + 1
  149. #define RST_Y                   REC_Y
  150.  
  151.  
  152. #define F1_SEP_X                3
  153. #define F1_SEP_Y                3
  154.  
  155.  
  156. #define STRING_LENGTH            30
  157.  
  158.  
  159. /* checks whether value is not equal to KRERR_NO_ERROR and if so, returns
  160. */
  161. #define CHECK_RETURN(ret_code)  if (ret_code != KRERR_NO_ERROR) \
  162.                                    return (ret_code)
  163.  
  164.  
  165.  
  166.  
  167.  
  168. static int      bn_art2_open = 0;
  169. static Widget   baseWidget;
  170. static Widget   art2UnitWidget[2], art2RowWidget[2];
  171.  
  172.  
  173.  
  174. static krui_err bn_art2_make_layer (
  175.                             int    units,
  176.                             int    rows,
  177.                             int    cols,
  178.                             int    Xbegin,
  179.                             int    Ybegin,
  180.                             int    Xsep,
  181.                             int    Ysep,
  182.                             char  *name_prefix,
  183.                             int    unit_ttype,
  184.                             char  *actfuncname,
  185.                             char  *outfuncname,
  186.                             int    NoOfSites,
  187.                             char **SiteNames,
  188.                             char **SiteFuncNames);                        
  189. static krui_err bn_art2_createNet (int f1Units, int f1Rows, int f2Units, int f2Rows);
  190. static void bn_art2_donePROC (void);
  191. static void bn_art2_createPROC (void);
  192.  
  193. /* end private definition section */
  194.  
  195. #endif
  196.